/**************************************************************************
** Qt Creator license header template
**   Special keywords: Programmer 2012/3/20 2012
**   Environment variables: 
**   To protect a percent sign, use '%'.
**************************************************************************/

#ifndef GLAREA_H
#define GLAREA_H
#include "meshmodel.h"// glew must be ahead of gl

#include <wrap/gui/trackball.h>
#include <wrap/gui/trackmode.h>

#include <QGLWidget>
#include <QMouseEvent>

class GLArea : public QGLWidget
{
    Q_OBJECT
public:
    explicit GLArea(QWidget *parent = 0);
    void updateDrawArea();

signals:
    void sendStatus(QString msg);
public slots:
    void loadMesh();
    void changeRenderMode(int i);
    void getQuadricParamsDialog();
    void createProgressiveMesh();
    void createMidpointPM();
    void clear();
    void showModelInfo();
    void cleanMesh();

protected:
    void initializeGL();
    void paintGL();
    void resizeGL(int w, int h);
    void mousePressEvent(QMouseEvent*e);
    void mouseMoveEvent(QMouseEvent*e);
    void mouseReleaseEvent(QMouseEvent*e);
    void wheelEvent(QWheelEvent*e);
private:
    MeshModel* currentModel;
    MeshModel::RenderMode renderMode;
    vcg::Trackball track;
};

#endif // GLAREA_H
